' If you need something in particular let me know:
' Steven W. Tilson
' CIS: 102022,1330
' 102022,1330@compuserve.com
' stilson@ATK.COM
' steve.tilson@windmill.com
' I would never copyright what I consider to be public knowledge.
' Therefore I claim no rights to the following code nor do I
' accept responsibility in any form or fashion for the consequences of
' usage of the code by any party private, commercial, educational,
' religious, government, alien, afterlife, or otherwise.
' Use at your own risk
' No warranty expressed or implied
' All of this can be found elsewhere if you look.
' If it looks like you wrote it that is great. Congratulations, you write good code just like me.
' All of this can be derived from the VB Manuals, VB Help files, or the Windows API.
' Windows and VB (Visual Basic) are copyrighted materials of Microsoft Corporation.
' For more great information buy books, magazines, development tools, programming languages,
' join user groups, participate in forum discussions, or whatever.
' Support the effort and you will be helping mankind to advance from the ooze of modern day anarchy.
'Now that all the legal mumbo jumbo is said, select it, cut it, and get to work!
'Whoever does the VB 3.0 FAQ should add this stuff to it.
Const WM_USER = &H400 ' straight from the API
Const EM_SETMODIFY = WM_USER + 9 ' straight from the API
Const EM_SETREADONLY = (WM_USER + 31) ' straight from the API
' The following should be all on one line
Declare Function SendMessage Lib "User" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long ' straight from the API
' end of the all on one line code
Sub SetReadOnly (tControl As Control)
'Sets the specified control to be read only
Dim s As Long
s = SendMessage(tControl.hWnd, EM_SETREADONLY, 1, 0)
End Sub
' shell out to a "child" process, wait till done before return
Declare Function GetModuleUsage Lib "Kernel" (ByVal hModule As Integer) As Integer
Sub GoShell (sShellString As String, iWinType As Integer)
Dim InstanceHandle As Integer, X As Integer
InstanceHandle = Shell(sShellString, iWinType)
Do While GetModuleUsage(InstanceHandle) > 0
X = DoEvents()
Loop
End Sub
' if you are networked here is how to get the userid from the network:
Declare Function WNetGetUser% Lib "USER" (ByVal User As String, BufSize As Integer)
Function GetUser () As String
Dim ReturnCode As Integer, size As Integer, UserName As String
GetUser = "Not logged on to network"
UserName = String$(255, 0)
size = Len(UserName)
ReturnCode = WNetGetUser%(UserName, size)
If ReturnCode = 0 Then
While Asc(Mid$(UserName, size, 1)) = 0
size = size - 1
Wend
GetUser = Left$(UserName, size)
End If
End Function
' how to make sure one date falls after a different date (check valid exp date, etc)